package editor;

import java.sql.*;

public class JDBCTest {
 
    public static void main(String[] args) throws SQLException {

        DriverManager.registerDriver(new com.mysql.jdbc.Driver());
        Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/fbp","FBP", "FBP");
 
        if (conn == null) {
            System.out.println("Нет соединения с БД!");
            System.exit(0);
        }
 
        Statement stmt = conn.createStatement();
        ResultSet rs = stmt.executeQuery("SELECT * FROM users");
 
        while (rs.next()) {
            System.out.println(rs.getRow() + ". " + rs.getString("name"));
        }
 
        stmt.close();
    }
}